<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改租户管理')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <input name="projects" id="projects" type="hidden" th:value="${projects}">
        <form class="form-horizontal m" id="form-elecCost-edit" th:object="${elecCostInfo}">
            <input name="elecCostId" th:field="*{elecCostId}" type="hidden" required>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">序号：</label>
                <div class="col-sm-8">
                    <input name="serialNumber" th:field="*{serialNumber}" class="form-control" type="text" required>
                </div>
            </div>
			
			<div class="form-group">
			    <label class="col-sm-3 control-label is-required">项目名称：</label>
			    <div class="col-sm-8">
			        <input name="projectName" th:field="*{projectName}" class="form-control" type="text" required>
			    </div>
			</div>
			
			<div class="form-group">
			    <label class="col-sm-3 control-label is-required">楼层号：</label>
			    <div class="col-sm-8">
			        <input name="floorName" class="form-control" type="text"  th:field="*{floorName}" required>

			    </div>
			</div>
			
			<div class="form-group">
			    <label class="col-sm-3 control-label is-required">房间号：</label>
			    <div class="col-sm-8">
			        <input name="roomNumber" th:field="*{roomNumber}" class="form-control" type="text" required>
			    </div>
			</div>
			
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">单位名称：</label>
                <div class="col-sm-8">
                    <input name="companyName" th:field="*{companyName}" class="form-control" type="text" required>
                </div>
            </div>
            
<!--			<div class="form-group">-->
<!--			    <label class="col-sm-3 control-label is-required">电费月份：</label>-->
<!--			    <div class="col-sm-8">-->
<!--			        <select class="form-control" name="elecMonth" th:field="*{elecMonth}" id="elecMonth" required>-->
<!--						<option value="">请选择月份</option>-->
<!--			            <option value="1月">1月</option>-->
<!--			            <option value="2月">2月</option>-->
<!--			            <option value="3月">3月</option>-->
<!--			            <option value="4月">4月</option>-->
<!--			            <option value="5月">5月</option>-->
<!--			            <option value="6月">6月</option>-->
<!--			            <option value="7月">7月</option>-->
<!--			            <option value="8月">8月</option>-->
<!--			            <option value="9月">9月</option>-->
<!--			            <option value="10月">10月</option>-->
<!--			            <option value="11月">11月</option>-->
<!--			            <option value="12月">12月</option>-->
<!--			        </select>-->
<!--			    </div>-->
<!--			</div>-->
			
			
			<div class="form-group">
			    <label class="col-sm-3 control-label is-required">表号：</label>
			    <div class="col-sm-8">
			        <input name="checkMeterNumber" th:field="*{checkMeterNumber}" class="form-control" type="text" required>
			    </div>
			</div>
			
			<div class="form-group">
			    <label class="col-sm-3 control-label is-required">上月A电表：</label>
			    <div class="col-sm-8">
			        <input name="degreePreA" th:field="*{degreePreA}" class="form-control" type="text" required>
			    </div>
			</div>
			
			<div class="form-group">
			    <label class="col-sm-3 control-label is-required">本月A电表：</label>
			    <div class="col-sm-8">
			        <input name="degreeIssueA" th:field="*{degreeIssueA}" class="form-control" type="text" required>
			    </div>
			</div>
			
			<div class="form-group">
			    <label class="col-sm-3 control-label is-required">上月B电表：</label>
			    <div class="col-sm-8">
			        <input name="degreePreB" th:field="*{degreePreB}" class="form-control" type="text" required>
			    </div>
			</div>
			
			<div class="form-group">
			    <label class="col-sm-3 control-label is-required">本月B电表：</label>
			    <div class="col-sm-8">
			        <input name="degreeIssueB" th:field="*{degreeIssueB}" class="form-control" type="text" required>
			    </div>
			</div>
			
			<div class="form-group">
			    <label class="col-sm-3 control-label is-required">上月C电表：</label>
			    <div class="col-sm-8">
			        <input name="degreePreC" th:field="*{degreePreC}" class="form-control" type="text" required>
			    </div>
			</div>
			
			<div class="form-group">
			    <label class="col-sm-3 control-label is-required">本月C电表：</label>
			    <div class="col-sm-8">
			        <input name="degreeIssueC" th:field="*{degreeIssueC}" class="form-control" type="text" required>
			    </div>
			</div>
			
			<div class="form-group">
			    <label class="col-sm-3 control-label is-required">上月D电表：</label>
			    <div class="col-sm-8">
			        <input name="degreePreD" th:field="*{degreePreD}" class="form-control" type="text" required>
			    </div>
			</div>
			
			<div class="form-group">
			    <label class="col-sm-3 control-label is-required">本月D电表：</label>
			    <div class="col-sm-8">
			        <input name="degreeIssueD" th:field="*{degreeIssueD}" class="form-control" type="text" required>
			    </div>
			</div>
			
			
			<div class="form-group">
			    <label class="col-sm-3 control-label is-required">电费乘率：</label>
			    <div class="col-sm-8">
			        <input name="elecRate" th:field="*{elecRate}" class="form-control" type="text" required>
			    </div>
			</div>
			<div class="form-group">
			    <label class="col-sm-3 control-label is-required">电费单价：</label>
			    <div class="col-sm-8">
			        <input name="elecUnitPrice" th:field="*{elecUnitPrice}" class="form-control" type="text" required>
			    </div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">电费月份：</label>
				<div class="col-sm-8">
					<input name="elecMonth" th:field="*{elecMonth}" class="form-control" placeholder="请输入月份" type="text" required>
				</div>
			</div>
			<div class="form-group">
			    <label class="col-sm-3 control-label is-required">抄表时间：</label>
			    <div class="col-sm-8">
			        <div class="input-group date">
			            <input name="checkMeterTime"  th:value="${#dates.format(elecCostInfo.checkMeterTime, 'yyyy-MM-dd')}" class="form-control" placeholder="请填写日期" type="text" required>
			            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
			        </div>
			    </div>
			</div>
			
			

<!-- 
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">租赁开始时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="tenantTime" th:value="${#dates.format(tenantInfo.tenantTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div> -->

<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label is-required">租赁期限：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="tenantTerm" th:field="*{tenantTerm}" class="form-control" type="text" required>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">
                <label class="col-sm-3 control-label is-required">收费：</label>
                <div class="col-sm-8">
                    <div class="check-box" id="chooseCharge">
                        <label class="check-box"> <input type="checkbox"  name="charges" value="0" /> 物管费 </label>
                        <label class="check-box"> <input type="checkbox"  name="charges" value="1" /> 水费 </label>
                        <label class="check-box"> <input type="checkbox"  name="charges" value="2" /> 照明费 </label>
                        <label class="check-box"> <input type="checkbox"  name="charges" value="3" /> 动力费 </label>
                        <label class="check-box"> <input type="checkbox"  name="charges" value="4" /> 公用电费 </label>
                        <label class="check-box"> <input type="checkbox"  name="charges" value="5" /> 空调电费 </label>
                        <label class="check-box"> <input type="checkbox"  name="charges" value="6" /> 空调油费 </label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">电表：</label>
                <div class="col-sm-8">
                    <div class="check-box" id="chooseAmmeter">
                        <label class="check-box"> <input type="checkbox"  name="ammeter" value="0" /> A表 </label>
                        <label class="check-box"> <input type="checkbox"  name="ammeter" value="1" /> B表 </label>
                        <label class="check-box"> <input type="checkbox"  name="ammeter" value="2" /> C表 </label>
                        <label class="check-box"> <input type="checkbox"  name="ammeter" value="3" /> D表 </label>
                    </div>
                </div>
            </div> -->

<!--            <div class="form-group">
                <label class="col-sm-3 control-label is-required" >状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box is-required" id="chooseStatus">
                        <label class="radio-box"> <input type="radio"  name="tenantStatus" value="0" /> 正常 </label>
                        <label class="radio-box"> <input type="radio"  name="tenantStatus" value="1" /> 临期 </label>
                        <label class="radio-box"> <input type="radio"  name="tenantStatus" value="2" /> 到期 </label>
                        <label class="radio-box"> <input type="radio"  name="tenantStatus" value="3" /> 异常 </label>
                    </div>
                </div>
            </div> -->
         <!--   <div class="form-group">
                <label class="col-sm-3 control-label is-required">分配项目：</label>
                <div class="col-sm-8">
                    <select name="projectId" id="projectId" class="form-control m-b"  >
                        <option th:each="SysProject:${projects}" th:text="${SysProject.projectName}" th:value="${SysProject.projectId}" th:field="*{projectId}"></option>
                    </select>
                </div>
            </div>-->
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var prefix = ctx + "guomao/elecCostManagement";
        /*将后台的值传入前台*/
        var elecCostInfo = [[${elecCostInfo}]];

        /*$(document).ready(function(){initChoice();})的简写
        * function () {}里面的内容是在页面都加载完才执行*/
        // $(function () {
        //    // initChargeChoice();
        //     //initStatusChoice();
        //    // initAmmeterChoice();
        // })

        // /*将收费项目中，（数据库的值），回显到前端，并勾选上。
        // * 1、将收费的值赋给变量choice
        // * 2、判choice是否为null或""
        // * 3、定义数组将（0,1,2,3,...）中","去掉，存入数组choices
        // * 4、遍历数组，遍历前端，并将数组的值与input标签内值比较
        // * 5、判断数组中值（存入数据库的值）是否等于标签上的值，若等于则勾选*/
        // function initChargeChoice(){
        //     var choice = tenantInfo.charges
        //     if (choice!=null&&choice!=""){
        //         var choices = choice.split(",");
        //         for (var i=0;i<choices.length;i++){
        //             $("#chooseCharge input").each(function () {
        //                 /*$(this)取出当前对象并转换为jQuery对象*/
        //                 if ($(this).val()==choices[i]){
        //                     $(this).parent().addClass("checked")
        //                     $(this).attr("checked",true)
        //                 }
        //             });
        //         }
        //     }

        // }

        // /*状态回显*/
        // function initStatusChoice(){
        //     var choice = tenantInfo.tenantStatus
        //     console.log("choice="+choice)
        //     $("#chooseStatus input").each(function () {
        //     if($(this).val()==choice){
        //         $(this).parent().addClass("checked")
        //         $(this).attr("checked",true)
        //     }
        //     });
        // }

        // /*电表回显*/
        // function initAmmeterChoice(){
        //     var choice = tenantInfo.ammeter
        //     if (choice!=null&&choice!=""){
        //         var choices = choice.split(",");
        //         for (var i=0;i<choices.length;i++){
        //             $("#chooseAmmeter input").each(function () {
        //                 /*$(this)取出当前对象并转换为jQuery对象*/
        //                 if ($(this).val()==choices[i]){
        //                     $(this).parent().addClass("checked")
        //                     $(this).attr("checked",true)
        //                 }
        //             });
        //         }
        //     }
        // }


        $("#form-elecCost-edit").validate({
            focusCleanup: true
        });

// 			表单提交操作
        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-elecCost-edit').serialize());
            }
        }

// 		月份格式判定
        $("input[name='checkMeterTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
		
    </script>
</body>
</html>